let { contextBridge, ipcRenderer } = require("electron");

let API_KEY = ["getConfig", "importConfig", "importCity", "startAllBuild", "startBuild", "openLogFile",'openDir'];
let invoke = {
  send: (key, data) => {
    ipcRenderer.send(key, data);
  },
  on: (key, fn) => {
    ipcRenderer.on(key, fn);
  },
};

API_KEY.forEach(function (key) {
  invoke[key] = function (data) {
    return ipcRenderer.invoke(key, data, {});
  };
});

contextBridge.exposeInMainWorld("electronAPI", invoke);
